//小数字(<100)因子分解
#include <cmath>
#include <cstdio>

bool judge_prime(int x);

int main(int argc, char const* argv[])
{
    int n;
    int prime_num[100];
    int prime_ex[100];
    int prime_size = 0;
    while (scanf("%d", &n) != EOF) {
        //int bound = (int)sqrt(n) + 1;
        for (int i = 2; i <= n; i++) {
            if (n % i == 0) {
                prime_num[prime_size] = i;
                prime_ex[prime_size] = 0;
                while (n % i == 0) {
                    prime_ex[prime_size]++;
                    n /= i;
                }
                prime_size++;
            }
            if (n == 1)
                break;
        }
        for (int i = 0; i < prime_size; i++) {
            if (i == 0)
                printf("%d", prime_num[i]);
            else
                printf("*%d", prime_num[i]);
            if (prime_ex[i] > 1)
                printf("^%d", prime_ex[i]);
        }
    }
    return 0;
}

bool judge_prime(int x)
{
    if (x <= 1)
        return false;
    int bound = (int)sqrt(x) + 1;
    for (int i = 2; i < bound; i++) {
        if (x % i == 0)
            return false;
    }
    return true;
}